using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EasyElasticLogger.NETFramework.ES.Models
{
    /// <summary>
    /// 日志级别枚举
    /// </summary>
    public enum LogLevel
    {
        /// <summary>
        /// 调试信息
        /// </summary>
        Debug,
        
        /// <summary>
        /// 普通信息
        /// </summary>
        Info,
        
        /// <summary>
        /// 警告信息
        /// </summary>
        Warn,
        
        /// <summary>
        /// 错误信息
        /// </summary>
        Error,
        
        /// <summary>
        /// 严重错误信息
        /// </summary>
        Fatal
    }
    
    /// <summary>
    /// LogLevel枚举扩展方法
    /// </summary>
    public static class LogLevelExtensions
    {
        /// <summary>
        /// 将LogLevel转换为字符串表示
        /// </summary>
        /// <param name="level">日志级别</param>
        /// <returns>日志级别的字符串表示</returns>
        public static string ToStringValue(this LogLevel level)
        {
            switch (level)
            {
                case LogLevel.Debug:
                    return "DEBUG";
                case LogLevel.Info:
                    return "INFO";
                case LogLevel.Warn:
                    return "WARN";
                case LogLevel.Error:
                    return "ERROR";
                case LogLevel.Fatal:
                    return "FATAL";
                default:
                    return "INFO";
            }
        }
    }
}